<jsp:directive.page contentType="text/html;charset=utf-8" />
<%@ include file="/taglibs.jsp" %>
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>


<head>
<title>Trading</title>
<link rel="stylesheet" type="text/css" 	href="${ctx}/scripts/jquery-chosen/chosen.css" />
<script type="text/javascript" src="${ctx}/scripts/jquery.fillOptions.js" ></script>
<script type="text/javascript" src="${ctx}/scripts/jquery-chosen/chosen.jquery.js" ></script>
<script type="text/javascript" src="${ctx}/scripts/jquery.displaytag.js" ></script>
</head>


<body>
<div class="container-fluid">
  <div class="row-fluid">
    <div class="span3">
      <%@ include file="/WEB-INF/jsps/includes/sideBar-main.jsp" %>
    </div>
    <div class="span9">
    <%-- Filter Form --%>
    <form id="filterForm" class="form-search">
    	<div class="well clearfix">
			<s:iterator value="category.primaryParentCategory.featureCategoryAppl" var="pfca" status="status">
				<div class="span3">
					<label class="span8" style="min-height:0"><s:property value="featureCategory.name"/></label>
					<select name="trade.featureIds[<s:property value='#status.index'/>]" class="chzn-select span8" id="">
						<option value="-1">所有</option> 
						<s:iterator value="featureCategory.features">
							<option value="<s:property value='id'/>"><s:property value='name'/></option>
						</s:iterator>
					</select>
				</div>	
			</s:iterator>
			 
			<s:iterator value="category.featureCategoryAppl" var="fca"  status="status">
				<div class="span3">
					<label class="span8" style="min-height:0"><s:property value="featureCategory.name"/></label>
					<select name="trade.featureIds[<s:property value='#status.index'/>]" class="chzn-select span8" id="">
						<option value="-1">不限</option> 
						<s:iterator value="featureCategory.features">
							<option value="<s:property value='id'/>"><s:property value='name'/></option>
						</s:iterator>
					</select>
				</div>
			</s:iterator>
			
			<div class="span3">
				<label class="span8" style="min-height:0"><s:text name="module.geo.area"/></label>
				<s:select id="selectArea" name="trade.geoCity.id"  cssClass="chzn-select span8"
					list="areaList" headerKey="-1" headerValue="所有城市"
					listKey="id" listValue="name" value="geo.id"></s:select>
			</div>
    	</div>
		<div class="input-append">
		  <input id="search_string" name="trade.title" type="text" class="search-query span8">
		  <button id="search_button" type="button" class="btn">Search</button>
		</div>
		<%-- --%>
		<select class="span2" name="trade.commercialFlag">
		  <option selected value="-1">不限</option>
			<option value="Y">商家</option>
			<option value="N">个人</option>
		</select>
			
		<div id="sort" class="btn-group">
			<button name="trade.createdDate" type="button" title="Sort by published date" class="btn btn-small btn-success">日期 <i class="icon-arrow-down icon-white"></i></button>
			<button name="trade.price" type="button" title="Sort by price" class="btn btn-small">价格 <i class="icon-arrow-up"></i></button>
		</div>
		<%-- TODO: add thumbnail list support.
		<div class="btn-group pull-right">
		 	  <button title="view as list" class="btn btn-small btn-success"><i class="icon-list"></i> 列表</button>
		 	  <button title="view as grid" class="btn btn-small "><i class="icon-th"/></i> 大图</button>
		</div>
		--%>
	</form>
	<%@ include file="/WEB-INF/jsps/trade/index_tradeList.jsp" %>
    </div>
  </div><!-- end row-fluid -->
</div>

<script>
$(function() {
	
	var currentCatId = 0;
	
	$(".nav-list li a").each(function() {
		//note that if use "location.href.indexOf(this.href)" may cause mismatch condition 
		//like id=OTHER and id=OTHER_XXX
		if (this.href.indexOf(location.href) > -1) {
			$("li.active").removeClass("active");
			$(this).parent().addClass("active");
			currentCatId = parseInt($(this).parent().parent().attr("id"));
		}
	});
	$( "#accordion" ).accordion( {heightStyle: "content",collapsible: true, active:currentCatId});
});
</script>
</body>
